var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/cmd/style-lint.ts
var style_lint_exports = {};
__export(style_lint_exports, {
  default: () => style_lint_default,
  stylelint: () => stylelint
});
module.exports = __toCommonJS(style_lint_exports);
var import_stylelint = require("stylelint");
var stylelint = async ({
  cwd,
  fix = true,
  files = "src/**/*.{css,less,scss}",
  syntax = void 0
}) => {
  try {
    const data = await (0, import_stylelint.lint)({
      files,
      globbyOptions: {
        cwd
      },
      fix,
      syntax
    });
    if (data) {
      const output = import_stylelint.formatters.string(JSON.parse(data.output));
      if (output) {
        console.log(output);
        process.exitCode = 1;
      }
    }
  } catch (err) {
    process.exitCode = 1;
  }
};
var style_lint_default = (api) => {
  api.registerCommand({
    name: "stylelint",
    description: "find and fix problems in your css,less,scss code with stylelint",
    details: `
$ umi stylelint [files] --fix --cache --syntax less

* files \u5F85\u6821\u9A8C\u7684\u6587\u4EF6\u5939\u6216\u6587\u4EF6\u5217\u8868\uFF0C\u9ED8\u8BA4 src/**/*.{css,less,scss}
* fix \u662F\u5426\u81EA\u52A8\u4FEE\u590D\u6587\u4EF6\uFF0C\u9ED8\u8BA4 true
* cache \u662F\u5426\u7F13\u5B58\u6821\u9A8C\u7ED3\u679C\uFF0C\u4E0B\u6B21\u6821\u9A8C\u65F6\u57FA\u4E8E\u7F13\u5B58\u7ED3\u679C\uFF0C\u9ED8\u8BA4 false
* syntax \u6307\u5B9A\u53E5\u6CD5\uFF0C"css-in-js" | "html" | "less" | "markdown" | "sass" | "scss" | "sugarss" | undefined
    `,
    async fn({ args }) {
      const { cwd } = api.paths;
      const { _: files, fix, syntax } = args;
      await stylelint({ cwd, fix, files, syntax });
    }
  });
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  stylelint
});
